<style>
.typeitem{	
	text-align:left;
	padding:0.5rem;
	background:#fff;
	background: var(--s-color-bg-primary,#fff);
    border: 1px solid rgba(0,0,0,.08);
    border: 1px solid var(--s-color-border-tertiary,rgba(0,0,0,.08));
}
.typeitem.active{
    border: 1px solid {{main.syscolor || '#7c1cc9'}};
}
.label-default {
    background-color: #f2f2f2;
	color: #999;
}
</style>
<div class="fui-tab-scroll" style="padding-bottom:0.5rem;height:2.4rem">
	<div ng-class="{'item':1,'on':pagedata.params.type==0}"><a href="javascript:" ng-click="pagedata.params.type=0;tool.get_list('/index/getlist/',true)">推荐</a></div>
	<div ng-class="{'item':1,'on':pagedata.params.type==1}"><a href="javascript:" ng-click="pagedata.params.type=1;tool.get_list('/index/getmyagent/',true)">自定义</a></div>
</div>
<div class="fui-cell-group radius" ng-repeat="item in pagedata.list">
	<div class="fui-cell" style="padding:0.35rem;">
		<div class="fui-cell-lable" style="width:auto;padding-right: 0.3rem;">
			<img style="border-radius: 100%;width:3.3rem;height:3.3rem" ng-src="{{tomedia(item.logo) || '../addons/jy_aiagent/resource/images/nv1.png'}}" />
		</div>
		<div class="fui-cell-text" style="">
			<div class="bold">{{item.title}}</div>
			<div class="gray overflow-h2">{{item.desc}}</div>
			<div class="gray"  style="line-height:1.2rem">
				<span class="label label-default">{{item.llm_modeltitle}}</span>
				<span class="label label-default">{{item.languagetitle||'中文'}}</span>
				<span class="label label-default">{{item.voice.title||'可爱'}}</span>
			</div>
		</div>
		<div class="fui-cell-remark noremark" style="padding-left:0.3rem;width:4.5rem">
			<div ng-if="pagedata.post.goodsid==0" ng-click="pagedata.showgoodslist=true;pagedata.post.agentid=item.id" class="btn btn-sm btn-success jy-btn1" style="color:#7783EA;border-radius:0.2rem">切换到设备</div>
			<div ng-if="pagedata.post.goodsid>0" ng-click="pagedata.qiehuan()" class="btn btn-sm btn-success jy-btn1" style="color:#7783EA;border-radius:0.2rem">切换该智能体</div>
			<div ng-if="pagedata.params.type==1" ng-click="access_json('/editagent//id='+item.id)" class="btn btn-sm btn-success jy-btn2" style="margin-top:0.5rem;color:red;border-radius:0.2rem">编辑角色</div>
		</div>
	</div>
</div>
<div class="content-empty" ng-show="!pagedata.list || pagedata.list.length == 0 ">
	<img style="border-radius: 100%;width:2rem;height:2rem" src="../addons/jy_aiagent/resource/images/goods.png" />
	<div style="padding-top:0.3rem;color: #999;font-size: .75rem">暂时没有智能体</div>
</div>
<div ng-if="pagedata.showgoodslist" class="popup">
	<div class="popup-body">
		<div class="popup-bottom radius">
		<i class="closed icon icon-cuowu" ng-click="pagedata.showgoodslist=false"></i>
		<div class="fui-cell-group radius" style="margin-top:1rem;-webkit-overflow-scrolling: touch;">
			<div ng-repeat="item in pagedata.goodslist" class="fui-cell" style="padding:0.35rem;">
				<div class="fui-cell-text" style="">
					<div class="bold">{{item.title||'设备名称'}}</div>
					<div class="gray">Mac地 址：{{item.macsn||'***.***.***.***'}}</div>
					<div class="gray">固件版本：{{item.gu_v||'1.7.2'}}</div>
				</div>
				<div class="fui-cell-remark noremark">
					<div ng-click="pagedata.post.goodsid=item.id;pagedata.qiehuan()" class="btn btn-sm btn-success jy-btn1" style="color:#7783EA;border-radius:0.2rem">切换到该设备</div>
				</div>
			</div>
			<div class="content-empty" ng-show="!pagedata.goodslist || pagedata.goodslist.length == 0 ">
				<img style="border-radius: 100%;width:2rem;height:2rem" src="../addons/jy_aiagent/resource/images/goods.png" />
				<div style="padding-top:0.3rem;color: #999;font-size: .75rem">您暂时没有设备</div>
			</div>
			<div class="fui-cellone" style="padding-top:0.5rem;padding-bottom:0">
					<div class="fui-cellone-text c">
						<div class="radius c" ng-click="access_json('jy_aiagent/index/')" style="background:#3263fe;color:#fff;padding:0.5rem">
							配置新设备
						</div>
					</div>	
			</div>
		</div>
		</div>
	</div>
</div>
<script>
var url='jy_aiagent/index/getlist/';
if(scope.pagedata.params.type==1){
	url='jy_aiagent/index/getmyagent/';
}
scope.tool.get_list(url,true);
scope.pagedata.scroll_bottom=function(){
	scope.tool.get_list(url);
}
scope.pagedata.qiehuan=function(item){
	scope.pagedata.post.qie_agenttype=scope.pagedata.params.type;
	scope.pagedata.post.qie_agentid=item?item.id:scope.pagedata.post.agentid;
	scope.post_json('jy_aiagent/agent/qiehuan/',scope.pagedata.post);
}
</script>